package com.app.micaihu.bean.config;

import android.text.TextUtils;

import com.app.micaihu.bean.ad.NativeAd;

import java.util.List;

/**
 * APP的服务器配置类
 * Created by linkai on 2016/7/14.
 */
public class AppControl {
    private String indexButtonSwitch;// 首页导航按钮开关 1开启 0关闭
    private String appStartImg;// 启动页面
    private String appChannelData;//栏目更新时间

    private String adUptime;//开屏广告更新时间
    private String showBottomImg;//是否显示底部
    private List<NativeAd> adList;//开屏广告集合
    private String adRatio;//广告出现几率
    private String preloadAdId;//预加载广告id
    private List<NativeAd> preloadAdList;//预加载广告集合
    private List<NativeAd> jiliAdInfo;//签到 激励视频

    private String topicExpireTime;//话题页面重新拉取时间
    private String pushExpireTime;//要闻推送的过期时间
    private String showGame;//是否显示游戏 1是 0否
    private String autoPlayVideo;//是否自动播放 1是 0否
    private String officialInviteCode;//官方邀请码
    private String hitGap;//首页的游戏弹窗间隔

    private ShareConfig shareConfig;//分享配置

    private String selectCate;//默认首页选中的栏目;1,2,3 : 游戏,推荐,原创;


    private String adPlayNum;//游戏广告的播放次数,超过两个不同的Id 的广告 播放次数大于adPlayNum,那么就不再播放了

    private ShowWakeScreen showWakeScreen;


    private String showAgreement;
    private String userAgreementUrl;
    private String privateAgreementUrl;
    private String agreementUrl;//隐私权限 url
    private String forceLogin;//1、强制登录；   0、非强制登录

    private Mission mission;

    private String popupStatus;//1、强制登录；   0、非强制登录
    private String popupImg;//1、强制登录；   0、非强制登录
    private String popupUrl;//1、强制登录；   0、非强制登录
    private int showSearchGame;//1、搜索显示结果；

    public int getShowSearchGame() {
        return showSearchGame;
    }

    public void setShowSearchGame(int showSearchGame) {
        this.showSearchGame = showSearchGame;
    }

    public List<NativeAd> getJiliAdInfo() {
        return jiliAdInfo;
    }

    public void setJiliAdInfo(List<NativeAd> jiliAdInfo) {
        this.jiliAdInfo = jiliAdInfo;
    }

    public String getPopupStatus() {
        return popupStatus;
    }

    public void setPopupStatus(String popupStatus) {
        this.popupStatus = popupStatus;
    }

    public String getPopupImg() {
        return popupImg;
    }

    public void setPopupImg(String popupImg) {
        this.popupImg = popupImg;
    }

    public String getPopupUrl() {
        return popupUrl;
    }

    public void setPopupUrl(String popupUrl) {
        this.popupUrl = popupUrl;
    }

    public String getForceLogin() {
        return forceLogin;
    }

    public void setForceLogin(String forceLogin) {
        this.forceLogin = forceLogin;
    }

    public String getIndexButtonSwitch() {
        return indexButtonSwitch;
    }

    public void setIndexButtonSwitch(String indexButtonSwitch) {
        this.indexButtonSwitch = indexButtonSwitch;
    }

    public Mission getMission() {
        return mission;
    }

    public void setMission(Mission mission) {
        this.mission = mission;
    }

    public static class Mission {

        /**
         * login_gold : 3
         * login_score : 10
         * comment_gold : 10
         * comment_currency : 5
         * share_gold : 10
         * share_currency : 5
         */

        private String login_gold;
        private String login_score;
        private String comment_gold;
        private String comment_currency;
        private String share_gold;
        private String share_currency;

        public String getLogin_gold() {
            return login_gold;
        }

        public void setLogin_gold(String login_gold) {
            this.login_gold = login_gold;
        }

        public String getLogin_score() {
            return login_score;
        }

        public void setLogin_score(String login_score) {
            this.login_score = login_score;
        }

        public String getComment_gold() {
            return comment_gold;
        }

        public void setComment_gold(String comment_gold) {
            this.comment_gold = comment_gold;
        }

        public String getComment_currency() {
            return comment_currency;
        }

        public void setComment_currency(String comment_currency) {
            this.comment_currency = comment_currency;
        }

        public String getShare_gold() {
            return share_gold;
        }

        public void setShare_gold(String share_gold) {
            this.share_gold = share_gold;
        }

        public String getShare_currency() {
            return share_currency;
        }

        public void setShare_currency(String share_currency) {
            this.share_currency = share_currency;
        }
    }

    public String getAgreementUrl() {
        return agreementUrl;
    }

    public void setAgreementUrl(String agreementUrl) {
        this.agreementUrl = agreementUrl;
    }

    public String getShowAgreement() {
        return showAgreement;
    }

    public void setShowAgreement(String showAgreement) {
        this.showAgreement = showAgreement;
    }

    public String getUserAgreementUrl() {
        return userAgreementUrl;
    }

    public void setUserAgreementUrl(String userAgreementUrl) {
        this.userAgreementUrl = userAgreementUrl;
    }

    public String getPrivateAgreementUrl() {
        return privateAgreementUrl;
    }

    public void setPrivateAgreementUrl(String privateAgreementUrl) {
        this.privateAgreementUrl = privateAgreementUrl;
    }

    public static class ShowWakeScreen {
        private int wakeSwitch;
        private int wakeTime;
        private int showNum;

        public int getWakeSwitch() {
            return wakeSwitch;
        }

        public void setWakeSwitch(int wakeSwitch) {
            this.wakeSwitch = wakeSwitch;
        }

        public int getWakeTime() {
            return wakeTime;
        }

        public void setWakeTime(int wakeTime) {
            this.wakeTime = wakeTime;
        }

        public int getShowNum() {
            return showNum;
        }

        public void setShowNum(int showNum) {
            this.showNum = showNum;
        }

        @Override
        public String toString() {
            return "ShowWakeScreen{" +
                    "wakeSwitch=" + wakeSwitch +
                    ", wakeTime=" + wakeTime +
                    ", showNum=" + showNum +
                    '}';
        }
    }

    public ShowWakeScreen getShowWakeScreen() {
        return showWakeScreen;
    }

    public void setShowWakeScreen(ShowWakeScreen showWakeScreen) {
        this.showWakeScreen = showWakeScreen;
    }

    public String getAdPlayNum() {
        return adPlayNum;
    }

    public void setAdPlayNum(String adPlayNum) {
        this.adPlayNum = adPlayNum;
    }

    public String getSelectCate() {
        return selectCate;
    }

    public void setSelectCate(String selectCate) {
        this.selectCate = selectCate;
    }

    private String showDetail;//是否展示详情中展开全文的 按钮 1显示 0不显示


    public boolean getShowDetail() {
        return TextUtils.equals(showDetail, "1");
    }

    public void setShowDetail(String showDetail) {
        this.showDetail = showDetail;
    }

    public String getOfficialInviteCode() {
        return officialInviteCode;
    }

    public void setOfficialInviteCode(String officialInviteCode) {
        this.officialInviteCode = officialInviteCode;
    }

    public String getPushExpireTime() {
        return pushExpireTime;
    }

    public void setPushExpireTime(String pushExpireTime) {
        this.pushExpireTime = pushExpireTime;
    }

    public String getAppStartImg() {
        return appStartImg;
    }

    public void setAppStartImg(String appStartImg) {
        this.appStartImg = appStartImg;
    }

    public String getAppChannelData() {
        return appChannelData;
    }

    public void setAppChannelData(String appChannelData) {
        this.appChannelData = appChannelData;
    }

    public String getAdUptime() {
        return adUptime;
    }

    public void setAdUptime(String adUptime) {
        this.adUptime = adUptime;
    }

    public List<NativeAd> getAdList() {
        return adList;
    }

    public void setAdList(List<NativeAd> adList) {
        this.adList = adList;
    }


    public boolean getAutoPlayVideo() {
        if (TextUtils.equals("1", autoPlayVideo)) {
            return true;
        }
        return false;
    }

    public void setAutoPlayVideo(String autoPlayVideo) {
        this.autoPlayVideo = autoPlayVideo;
    }

    /**
     * 返回广告配置的json字符串
     *
     * @return
     */
    public String adListToJson() {
        if (adList == null || adList.size() == 0
                || adList.get(0) == null) {
            return "";
        }
        NativeAd nativeAd = adList.get(0);
        String pic = "";
        if (nativeAd != null && nativeAd.getThumbList().length > 0) {
            pic = nativeAd.getThumbList()[0];
        }
        String adJson = "{" +
                "'adId':'" + nativeAd.getAdId() + "'," +
                "'adPosition':'" + nativeAd.getAdPosition() + "'," +
                "'style':'" + nativeAd.getStyle() + "'," +
                "'adType':'" + nativeAd.getAdType() + "'," +
                "'thumbList':'" + pic + "'," +
                "'title':'" + nativeAd.getTitle() + "'," +
                "'summary':'" + nativeAd.getSummary() + "'," +
                "'jumpUrl':'" + nativeAd.getJumpUrl() + "'," +
                "'appIcon':'" + nativeAd.getAppIcon() + "'," +
                "'serialId':'" + nativeAd.getSerialId() + "'" +
                "}";
        /********现在只有一个配置所以只取第一个 ******/
//        String adJson = "[";
//        for(int i=0;i<adList.size();i++){
//            NativeAd nativeAd = adList.get(i);
//            adJson += "{" +
//                    "'adId':'"+nativeAd.getAdId()+"'," +
//                    "'adPosition':'"+nativeAd.getAdPosition()+"'," +
//                    "'style':'"+nativeAd.getStyle()+"'," +
//                    "'adType':'"+nativeAd.getAdType()+"'" +
//                    "}";
//            if(i != adList.size() - 1){
//                adJson += ",";
//            }
//        }
//        adJson += "]";
        return adJson;
    }

    public boolean getShowBottomImg() {
        // 1代表展示底部  0代表隐藏底部 默认返回隐藏
        if (TextUtils.equals("1", showBottomImg)) {
            return true;
        } else if (TextUtils.equals("0", showBottomImg)) {
            return false;
        }
        return false;
    }

    public void setShowBottomImg(String showBottomImg) {
        this.showBottomImg = showBottomImg;
    }

    public String getAdRatio() {
        return adRatio;
    }

    public void setAdRatio(String adRatio) {
        this.adRatio = adRatio;
    }

    public String getPreloadAdId() {
        return preloadAdId;
    }

    public void setPreloadAdId(String preloadAdId) {
        this.preloadAdId = preloadAdId;
    }

    public List<NativeAd> getPreloadAdList() {
        return preloadAdList;
    }

    public void setPreloadAdList(List<NativeAd> preloadAdList) {
        this.preloadAdList = preloadAdList;
    }

    public String getTopicExpireTime() {
        return topicExpireTime;
    }

    public void setTopicExpireTime(String topicExpireTime) {
        this.topicExpireTime = topicExpireTime;
    }

    public boolean getShowGame() {
        if (TextUtils.equals(showGame, "0")) {
            return false;
        } else if (TextUtils.equals(showGame, "1")) {
            return true;
        }
        return true;
    }

    public void setShowGame(String showGame) {
        this.showGame = showGame;
    }

    public String getHitGap() {
        return hitGap;
    }

    public void setHitGap(String hitGap) {
        this.hitGap = hitGap;
    }

    public ShareConfig getShareConfig() {
        return shareConfig;
    }

    public void setShareConfig(ShareConfig shareConfig) {
        this.shareConfig = shareConfig;
    }
}
